<?php require_once("header.php");?>   
<?php require_once("php/carousel.php");?>     
<?php $recipes = json_decode(api("all_recipes/".$user_id,"GET",null),true);?>     
<?php 
if(isset($_GET['author']) && is_numeric($_GET['author'])):
	$author = $_GET['author'];
endif;
?>
<h3><?php echo $_GET['nickname'];?>'s Recipes</h3>

<?php if (userRecipeCount($recipes, $author)>0):?>
<br />
<input type="text" class="tags filter" placeholder="Filter by tags or ingredients. (ex: Breakfast, Kid Friendly, Sandwich)" />
<input id="filter" type="button" value="Filter Recipes" />
<?php endif;?>

<?php displayCarousel($recipes,"user",null,$author);?>

<?php $activity = json_decode(api("latest_activity/".$user_id."/".$author,"GET",null),true);?> 
<?php require_once("php/activity.php");?>

<script>
setFilter();

// tags
<?php $tags = api("tags/","GET",null);?>
var tempTags = <?php echo $tags;?>;
var tags = new Array();
for(var i=0; i<tempTags.length; i++){
	tags[i] = tempTags[i]['name'];;
}

// ingredients
<?php $ingredients = api("ingredients/","GET",null);?>
var tempIngredients = <?php echo $ingredients;?>;
var ingredients = new Array();
for(var i=0; i<tempIngredients.length; i++){
	ingredients[i] = tempIngredients[i]['name'];;
}

var combined = tags.concat(ingredients);
setAutoComplete("tags",false,combined,true);
</script>

<?php require_once("footer.php");?>    